﻿@{
    ViewBag.Title = "Add or Update Special";
}

@using Helper

<script src="@Url.ContentArea("~/Content/javascript/Product.js")" type="text/javascript"></script>
<script src="@Url.ContentArea("~/Content/javascript/ProductAttribute.js")" type="text/javascript"></script>
@Html.Action("_AddOrUpdate", "ProductManagement", new { id = Model })

<script type="text/javascript">
    ///Document Ready jQuery
    $(document).ready(function () {
        $('#fileuploadproduct').fileupload({
            dataType: 'json',
            url: '/Administrator/ProductManagement/UploadFiles?dir=Product',
            autoUpload: true,
            done: function (e, data) {
                $('#imageproduct').html('<img width=\"70px\" height=\"70px\" src="/Media/Product/' + data.result.name + '" />');
            }
        }).on('fileuploadprogressall', function (e, data) {
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('.progress .progress-bar').css('width', progress + '%');
        });

        CKEDITOR.replace("FullDescription", { filebrowserBrowseUrl: '/Areas/Administrator/Content/ckeditor/plugins/filemanager/index.html' });


        //******productattribute*******
        FirstLoadProductAttribute();
        $('#AttributeID').on('change', function () {
            ComboboxAtributeChange();
        });
        $('#fileuploadproductattribute').fileupload({
            dataType: 'json',
            url: '/Administrator/ProductAttributeManagement/UploadFiles?dir=ProductAttribute',
            autoUpload: true,
            done: function (e, data) {
                $('#imageattribute').html('<img width=\"70px\" height=\"70px\" src="/Media/ProductAttribute/' + data.result.name + '" />');

            }
        }).on('fileuploadprogressall', function (e, data) {
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('.progress .progress-bar').css('width', progress + '%');
        });

        jQuery(".cmdupdateproductattribute").UpdateProductAttribute();

        $(".showedit").live("click", function (e) {
            var $this = $(this);
            ShowEdit(e, $this);
        });

        $(".delete").live("click", function (e) {
            var $this = $(this);
            DeleteProductAttribute(e, $this);
        });


        $("#StartDate").datetimepicker({ format: 'd/m/Y' });
        $("#EndDate").datetimepicker({ format: 'd/m/Y' });

        //********END*****************

    });
</script>